package cn.laixueit;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class TestMybatis {
    public static void main(String[] args) {
        try {
            InputStream stream = Resources.getResourceAsStream("mybatis.xml");
            SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(stream);
            SqlSession session = sqlSessionFactory.openSession();
            List<Object> list = session.selectList("test.selectall");
            System.out.println(list);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
